package tr.edu.metu.is.mega.client.service;

import java.util.List;

import tr.edu.metu.is.mega.common.dto.ScheduleTemplateDTO;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

/**
 * GWT schedule service.
 */
@RemoteServiceRelativePath("../GwtScheduleService")
public interface GwtScheduleService extends RemoteService {

    /**
     * Utility class for simplifying access to the instance of async service.
     */
    public static class Util {

        private static GwtScheduleServiceAsync instance;

        public static GwtScheduleServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(GwtScheduleService.class);
            }
            return instance;
        }
    }

    /**
     * Creates schedule template record.
     * 
     * @param scheduleTemplate schedule template instance
     * @return created schedule template instance
     */
    ScheduleTemplateDTO createSchedule(ScheduleTemplateDTO scheduleTemplate);

    /**
     * Updates schedule template record.
     * 
     * @param scheduleTemplate scheduleTemplate instance
     * @return updated scheduleTemplate instance
     */
    ScheduleTemplateDTO updateSchedule(ScheduleTemplateDTO scheduleTemplate);

    /**
     * Deletes schedule template record
     * 
     * @param scheduleTemplate to be deleted
     */
    void deleteSchedule(ScheduleTemplateDTO scheduleTemplate);

    /**
     * Returns list of schedule templates.
     * 
     * @return list of schedule templates
     */
    public List<ScheduleTemplateDTO> getScheduleTemplates();
}
